﻿using GENERIC.Respository.Interfaces;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data.Objects;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

namespace GENERIC.Repository.Tests
{
    public class MokeSet<TEntity> : IGENERICSet<TEntity> where TEntity : class, new()
    {
        #region Attributs
        
        HashSet<TEntity> _data;
        IQueryable _query;

        #endregion

        #region Constructor

        public MokeSet() : this(new List<TEntity>())
        {

        }
        
        public MokeSet(IEnumerable<TEntity> testData)
        {
            _data = new HashSet<TEntity>(testData);
            _query = _data.AsQueryable();
        }

        #endregion

        public void Insert(TEntity entity)
        {
            _data.Add(entity);
        }

        public void Update(TEntity entity)
        {
            
        }

        public void Delete(TEntity entity)
        {
            _data.Remove(entity);
        }

        public IQueryable<TEntity> Query()
        {
            return _data.AsQueryable();
        }
    }
}
